<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TestBat.Frontend.Controllers.ViewData.Test.Tasks.MultipleChoiceTaskViewData>" %>

<script type="text/javascript">

    $(function() {
    $("#MultipleChoiceSolution\\$<%= Model.TestTaskID %>").change(function() {
            $.ajax( {
                url: "<%=Url.Content("~/Test/SaveMultipleChoiceSolution") %>",
                data: { testTaskID: "<%=Model.TestTaskID %>", choiceID: $("#MultipleChoiceSolution\\$<%= Model.TestTaskID %>:checked").val() }
            });
        });
    });
</script>

<p class="question"><%= Model.Task.Question %></p>
<p class="answer">

<% foreach (TestBat.IModels.Domain.ITestChoice choice in Model.Task.Choices)
   { %>
    <span style="display:block" class="choice">
        <%= Html.RadioButton("MultipleChoiceSolution$" + Model.TestTaskID.ToString(), choice.ID, (Model.Solution != null && Model.Solution.Pick != null && Model.Solution.Pick.Equals(choice)) ? true : false) %>
        <%= choice.Text %>
    </span>
<% } %>

</p>
